#ifndef NOTIFICATIONMANAGER_H
#define NOTIFICATIONMANAGER_H

#include <QObject>
#include <QSharedPointer>
#include <MediaObject>
#include <AudioOutput>
#include "notification.h"
#include "notificator.h"
#include "singleton.h"

namespace Wishmaster
{
	class NotificationManager : public QObject, public Singleton<NotificationManager>
	{
		Q_OBJECT
	public:
		explicit NotificationManager(QObject *parent = 0);
		virtual ~NotificationManager();

		void newMessagesNotification(const QString& text);

		QStringList notificators();
		void setActiveNotificator(const QString& id);
		QSharedPointer<QWidget> makeConfig();
		bool updateConfig(const QSharedPointer<QWidget>& config);

		bool loadPluginsFromDirectory(const QString& pluginDirectory);

		void setPlaySounds(bool playsound);
		bool isPlaySounds() const;

	signals:

	public slots:
		void emitNotification(const Notification& notification);

	protected:
		bool factoryLoaded(const QString& id);
		QString getDefaultNotificator();

	private:
		QSharedPointer<Notificator> m_notificator;
		QList<QSharedPointer<NotificatorFactory> > m_factories;
		Phonon::MediaObject* m_player;
		Phonon::AudioOutput* m_output;
		bool m_playSound;
	};
}

#endif // NOTIFICATIONMANAGER_H
